<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录</title>

    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="ReSources/css/login.css">
    <!-- /container -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<!--使用模态框的方式模拟一个登陆框-->
<div class="modal show" id="loginModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close">&times;</button>
                <h1 class="text-center text-primary">登录</h1>
            </div>
            <div class="modal-body">
                <form class="form col-md-12 center-block" id="loginForm" action="/webapp_war/login" method="post">
                    <div class="form-group-lg" id="accountDiv">
                        <label class="sr-only" for="username">账号</label>
                        <div class="input-group">
                            <div class="input-group-addon">
                                <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
                            </div>
                            <input class="form-control" id="username" name="username"
                                   type="text" placeholder="账号" required autofocus>
                        </div>
                    </div>
                    <br>
                    <div class="form-group-lg" id="pwdDiv">
                        <label class="sr-only" for="userpassword">密码</label>
                        <div class="input-group">
                            <div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
                            <input class="form-control" id="userpassword" name="userpassword" type="password"
                                   placeholder="密码" required>
                            <div class="input-group-addon">
                                <span class="glyphicon glyphicon-eye-open"></span>
                            </div>
                        </div>
                        <div class="hidden text-center" id="pwdMsg">
                            <span class="glyphicon glyphicon-exclamation-sign">${mess}</span>
                        </div>
                    </div>
                    <script type="text/javascript">
                        function checkZmOrNum(zmnum){
                            var zmnumReg=/^[0-9a-zA-Z]*$/;
                            if(zmnum!=""&&!zmnumReg.test(zmnum)){
                                alert("只能输入是字母或者数字,请重新输入");
                                return false;
                            }
                        }
                        function login(){
                            //定义变量username
                            var username = $("input[id='username']").val();
                            var password = $("input[id='userpassword']").val();
                            if(checkZmOrNum(username)&&checkZmOrNum(password)){
                            window.location.href="login?username="+username+
                                "&password="+password;
                            }
                        }
                    </script>
                    <div class="checkbox">
                        <label> <input type="checkbox">记住密码</label>
                    </div>
                    <script typr="text/javascript">
                        function register() {//跳转到注册界面reg.jsp进行注册
                            window.location.href="reg.jsp"
                        }
                    </script>
                    <div class="form-group">
                        <%--            <button class="btn btn-default btn-lg col-md-6" id="btn_register" type="submit">注册</button>--%>
                        <button class="btn btn-primary btn-lg col-md-6" id="btn_login"
                                type="submit"> 登录
                        </button>
                        <button class="btn btn-primary btn-lg col-md-6" id="btn_login"
                                type="button" onclick="register()"> 注册
                        </button>
                    </div>

                </form>
            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div>
<%--<%String userName=request.getParameter("id");%>--%>
<%--<%="file"+userName%>--%>
<div>
    <%String userName = request.getParameter("id");%>
    <%="file"+userName%>
</div>

<%--                <h1>用户登录</h1>--%>
<%--            </div>--%>

<%--<form action="/webapp_war/login" method="post">--%>
<%--    <p>--%>
<%--        用户名：<input type="text" name="username">--%>
<%--    </p>--%>
<%--    <p>--%>
<%--        密码：<input type="text" name="userpassword">--%>
<%--    </p>--%>
<%--    <p>--%>
<%--        <input type="submit" value="登录">--%>
<%--    </p>--%>
<%--</form>--%>
<%--${mess}--%>
</body>
</html>
